package com.ruoyi.websocket.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.Date;

/**
 * 接收的WebSocket消息实体（按照截图格式）
 * 
 * @author ruoyi
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class ReceiveMessage {
    
    /** 消息类型: like | comment | follow | message */
    private String type;
    
    /** 用户ID */
    private Long userId;
    
    /** 用户名 */
    private String userName;
    
    /** 消息内容 */
    private String content;
    
    /** 视频ID（可选） */
    private Long videoId;
    
    /** 视频标题（可选） */
    private String videoTitle;
    
    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'")
    private Date createdAt;
    
    /** 时间戳（前端发送的timestamp字段） */
    private Long timestamp;
    
    public ReceiveMessage() {
        this.createdAt = new Date();
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Long getVideoId() {
        return videoId;
    }

    public void setVideoId(Long videoId) {
        this.videoId = videoId;
    }

    public String getVideoTitle() {
        return videoTitle;
    }

    public void setVideoTitle(String videoTitle) {
        this.videoTitle = videoTitle;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }

    @Override
    public String toString() {
        return "ReceiveMessage{" +
                "type='" + type + '\'' +
                ", userId=" + userId +
                ", userName='" + userName + '\'' +
                ", content='" + content + '\'' +
                ", videoId=" + videoId +
                ", videoTitle='" + videoTitle + '\'' +
                ", createdAt=" + createdAt +
                ", timestamp=" + timestamp +
                '}';
    }
}
